<extend name="Index/index" />
<block name='css_link'>
<link href="__PUBLIC__/Admin/vendors/bower_components/animate.css/animate.min.css" rel="stylesheet">
<link href="__PUBLIC__/Admin/vendors/bower_components/bootstrap-sweetalert/lib/sweet-alert.css" rel="stylesheet">
<link href="__PUBLIC__/Admin/vendors/bower_components/material-design-iconic-font/dist/css/material-design-iconic-font.min.css" rel="stylesheet">
<link href="__PUBLIC__/Admin/vendors/bower_components/malihu-custom-scrollbar-plugin/jquery.mCustomScrollbar.min.css" rel="stylesheet">        
<link href="__PUBLIC__/Admin/vendors/bower_components/bootstrap-select/dist/css/bootstrap-select.css" rel="stylesheet">
<link href="__PUBLIC__/Admin/vendors/bower_components/nouislider/distribute/jquery.nouislider.min.css" rel="stylesheet">
<link href="__PUBLIC__/Admin/vendors/bower_components/eonasdan-bootstrap-datetimepicker/build/css/bootstrap-datetimepicker.min.css" rel="stylesheet">
<link href="__PUBLIC__/Admin/vendors/farbtastic/farbtastic.css" rel="stylesheet">
<link href="__PUBLIC__/Admin/vendors/bower_components/chosen/chosen.min.css" rel="stylesheet">
<link href="__PUBLIC__/Admin/vendors/summernote/dist/summernote.css" rel="stylesheet">
</block>
<block name="content">
	<div class="container">
		<div class="card" style="padding: 10px 0 0 20px;">
			<button class="btn btn-default btn-icon-text waves-effect" onclick="location.href = '{:U(\"Article/index\")}'"><i class="zmdi zmdi-arrow-back"></i> 返回</button>
	        <form class="form-horizontal" id="myform" role="form" action="{:U('Article/update')}" method="post">
	            <div class="card-header">
	                <h2>修改文章</h2>
	            </div>
	            
	            <div class="card-body card-padding">
	                <div class="form-group" style="display: none;">
	                    <label for="inputPassword3" class="col-sm-2 control-label">Check Password</label>
	                    <div class="col-sm-10">
	                        
	                        <div class="fg-line">
	                            <input class="form-control input-sm" id="inputPassword3" placeholder="Password" type="password">
	                        </div>
	                    </div>
	                </div>
	                <div class="form-group">
	                    <label for="inputPassword3" class="col-sm-2 control-label">标题</label>
	                    <div class="col-sm-10">
	                        
	                        <div class="fg-line">
	                            <input class="form-control input-sm" id="title" placeholder="title" type="text" name="title" value="{$data.title}">
	                        </div>
	                    </div>
	                </div>
	                <div class="form-group">
	                    <label for="inputPassword3" class="col-sm-2 control-label">作者</label>
	                    <div class="col-sm-10">
	                        
	                        <div class="fg-line">
	                            <input class="form-control input-sm" id="author" placeholder="author" type="text" name="author" value="{$data.author}">
	                        </div>
	                    </div>
	                </div>
	                <div class="form-group">
	                    <label for="inputPassword3" class="col-sm-2 control-label">简介</label>
	                    <div class="col-sm-10">
	                        
	                        <div class="fg-line">
	                            <input class="form-control input-sm" id="intro" placeholder="introduce" type="text" name="intro" value="{$data.intro}">
	                        </div>
	                    </div>
	                </div>
	                <div class="form-group">
	                    <label for="inputPassword3" class="col-sm-2 control-label">关键词</label>
	                    <div class="col-sm-10">
	                        
	                        <div class="fg-line">
	                            <input class="form-control input-sm" id="keywords" placeholder="请用逗号分隔" type="text" name="keywords" value="{$data.keywords}">
	                        </div>
	                    </div>
	                </div>
                    <div class="card-header">
                        <h2>文章内容</h2>
                    </div>
                    <div class="card-body card-padding">
                        <div class="html-editor">{$data.details}</div>
                    </div>
	                <div class="form-group">
	                    <div class="col-sm-offset-2 col-sm-10">
	                        <button type="submit" class="btn btn-primary btn-sm waves-effect">修 改</button>
	                    </div>
	                </div>
	            </div>
	        </form>
	    </div>
    </div>
</block>
<block name='js_link'>
	<script src="__PUBLIC__/Admin/vendors/bower_components/jquery/dist/jquery.min.js"></script>
    <script src="__PUBLIC__/Admin/vendors/bower_components/bootstrap/dist/js/bootstrap.min.js"></script>
    
    <script src="__PUBLIC__/Admin/vendors/bower_components/malihu-custom-scrollbar-plugin/jquery.mCustomScrollbar.concat.min.js"></script>
    <script src="__PUBLIC__/Admin/vendors/bower_components/Waves/dist/waves.min.js"></script>
    <script src="__PUBLIC__/Admin/vendors/bootstrap-growl/bootstrap-growl.min.js"></script>
    <script src="__PUBLIC__/Admin/vendors/bower_components/bootstrap-sweetalert/lib/sweet-alert.min.js"></script>
    
    <script src="__PUBLIC__/Admin/vendors/bower_components/moment/min/moment.min.js"></script>
    <script src="__PUBLIC__/Admin/vendors/bower_components/bootstrap-select/dist/js/bootstrap-select.js"></script>
    <script src="__PUBLIC__/Admin/vendors/bower_components/nouislider/distribute/jquery.nouislider.all.min.js"></script>
    <script src="__PUBLIC__/Admin/vendors/bower_components/eonasdan-bootstrap-datetimepicker/build/js/bootstrap-datetimepicker.min.js"></script>
    <script src="__PUBLIC__/Admin/vendors/bower_components/typeahead.js/dist/typeahead.bundle.min.js"></script>
    <script src="__PUBLIC__/Admin/vendors/summernote/dist/summernote-updated.min.js"></script>


    <!-- Placeholder for IE9 -->
    <!--[if IE 9 ]>
        <script src="__PUBLIC__/Admin/vendors/bower_components/jquery-placeholder/jquery.placeholder.min.js"></script>
    <![endif]-->
    
    <script src="__PUBLIC__/Admin/vendors/bower_components/chosen/chosen.jquery.min.js"></script>
    <script src="__PUBLIC__/Admin/vendors/fileinput/fileinput.min.js"></script>
    <script src="__PUBLIC__/Admin/vendors/input-mask/input-mask.min.js"></script>
    <script src="__PUBLIC__/Admin/vendors/farbtastic/farbtastic.min.js"></script>
    <script src="__PUBLIC__/Admin/js/functions.js"></script>
    <script src="__PUBLIC__/Admin/js/demo.js"></script>
	
</block>
<block name='js_code'>
	<script type="text/javascript">
		$(document).ready(function() {
			$("#myform").on('submit', function(){
				var id = {$id};
				var title = $("#title").val();
				var author = $("#author").val();
				var intro = $("#intro").val();
				var keywords = $("#keywords").val();
				var details = $(".note-editable>p").html();
				
				$.post("{:U('Article/update')}",{id,title,author,intro,keywords,details},function(data){
					if (data == 'success') {
						alert('修改成功');
					}else{
						alert('修改失败');
					}
					location.reload();
				});
				return false;
			})
		})
	</script>
</block>